# 析构函数__del__()用来释放资源，当对象不再被使用时，Python解释器自动调用析构函数，释放对象占用的资源。
class Complex:
    def __init__(self, realpart, imagpart):
        self.r = realpart
        self.i = imagpart

    def __del__(self):
        print("Destructor called, releasing resources")


c = Complex(3.0, -4.5)
print(c.r, c.i)
print(c)
del c
